<<<<<<< HEAD
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DiskFactory : MonoBehaviour
{
    public List<Disk> used = new List<Disk>();
    public List<Disk> free = new List<Disk>();

    public Disk GetDisk()
    {
        Disk disk_prefab = null;
        int rand = Random.Range(1, 4);
        if (free.Count > 10)
        {
            disk_prefab = free[0];
            disk_prefab.getGameObject().SetActive(true);
            free.Remove(free[0]);
        }
        else
        {
            disk_prefab = new Disk("disk"+rand);
        }
        used.Add(disk_prefab);
        return disk_prefab;
    }

    public void ResetDisk(Disk disk)
    {
        disk.Power = 0;
        disk.Angle = 0;
        disk.Gravity = 0;
    }

    public void FreeDisk(GameObject disk)
    {
        for (int i = 0; i < used.Count; i++)
        {
            if (disk.GetInstanceID() == used[i].getGameObject().GetInstanceID())
            {
                ResetDisk(used[i]);
                used[i].getGameObject().SetActive(false);
                free.Add(used[i]);
                used.Remove(used[i]);
                break;
            }
        }
    }
=======
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DiskFactory : MonoBehaviour
{
    public List<Disk> used = new List<Disk>();
    public List<Disk> free = new List<Disk>();

    public Disk GetDisk()
    {
        Disk disk_prefab = null;
        int rand = Random.Range(1, 4);
        if (free.Count > 10)
        {
            disk_prefab = free[0];
            disk_prefab.getGameObject().SetActive(true);
            free.Remove(free[0]);
        }
        else
        {
            disk_prefab = new Disk("disk"+rand);
        }
        used.Add(disk_prefab);
        return disk_prefab;
    }

    public void ResetDisk(Disk disk)
    {
        disk.Power = 0;
        disk.Angle = 0;
        disk.Gravity = 0;
    }

    public void FreeDisk(GameObject disk)
    {
        for (int i = 0; i < used.Count; i++)
        {
            if (disk.GetInstanceID() == used[i].getGameObject().GetInstanceID())
            {
                ResetDisk(used[i]);
                used[i].getGameObject().SetActive(false);
                free.Add(used[i]);
                used.Remove(used[i]);
                break;
            }
        }
    }
>>>>>>> af278523501920b14a6298f03aa4bd9ad9d33c2d
}